package com.zy.xuanwo.zyc.portal.parser.imp;



import com.zy.xuanwo.zyc.portal.bean.Device;
import com.zy.xuanwo.zyc.portal.parser.BaseParser;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * remarks:
 * Created by ChowYvlChen on 2016/7/5  16:11
 */
public class DevicesParser extends BaseParser<Device> {
    private  Device mDevice=null;

    @Override
    public Device parserJSON(String jsonStr) throws JSONException {
        if (super.ParseResultPoly(jsonStr) == null) {
            mDevice = new Device();
            JSONObject mJSONObject = new JSONObject(jsonStr);
            if (mJSONObject.has("device_token")) {
                mDevice.setDevice_token(mJSONObject.getString("device_token"));
            }
            if (mJSONObject.has("device_id")) {
                mDevice.setDevice_id(mJSONObject.getString("device_id"));
            }
        }
        return mDevice;
    }
}
